//Page Object
// 引入 发送请求方法
import {request} from "../../request/request.js";
Page({
  data: {
    // 輪播圖數組
    swiperList:[],
    /* 导航数组 */
    catesList:[],
    /* 楼层数组 */
    floorList:[]
  },
  //options(Object)
  onLoad: function(options){
    this.getSwiperList(),
    this.getCatesList(),
    this.getFloorList()
  },
  getSwiperList(){
      request({url:'/home/swiperdata'})
      .then(result=>{
        result.data.message.map((item)=>{
          item.navigator_url = item.navigator_url.replace('main','index')
        })
        this.setData({
          swiperList:result.data.message
        })
      })
  },
  /* 获取导航数组 */
  getCatesList(){
    request({url:'/home/catitems'})
    .then(result=>{
      this.setData({
        catesList:result.data.message
      })
    })
  },
    /* 获取楼层数组 */
    getFloorList(){
      request({url:'/home/floordata'})
      .then(result=>{
        this.setData({
          floorList:result.data.message
        })
      })
    }
});